#!/usr/bin/python3

from bs4 import BeautifulSoup
from urllib import request

print('----')

root = 'https://wap.ithome.com'

page = '/html/356481.htm'

req = request.Request(root + page)
resp = request.urlopen(req)
html_text = resp.read().decode('utf-8')

# print(html_text)


soup = BeautifulSoup(html_text, "html.parser")

print(soup.title.string)

print(soup.find(class_='pt_info pre1'))

print('--------------------------')

content = soup.find(id='paragraph')
print(content)

print('--------------------------')

ps = content.findAll(name='p')

for p in ps:
    print(p)
